#[macro_export]
macro_rules! error_gen {
    {
        $(#[$m:meta])*
        $v:vis $name:ident{
            $(
                $var:ident=$t:ty
            )*
        }
    } => {
        $(#[$m])*
        #[derive(Debug)]
        $v enum $name{
            $(
                $var($t)
            ),*

        }

        $(
            impl From<$t> for $name{
                fn from(var:$t)->Self{
                    $name::$var(var)
                }
            }
        )*

    };
    {
        $(#[$m:meta])*
        $v:vis $name:ident=>$msg:literal
    } => {
        $(#[$m])*
        #[derive(Debug)]
        $v struct $name;

        impl std::fmt::Display for $name{
            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(f,$msg)
            }
        }
    }
}
